home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / ultra250.zip / UW_TUT9.C < prev    next >
Text File  |  1992-11-02  |  21KB  |  565 lines

  1. /****************************************************************************/
  2. /* UW_TUT9.C                                                                */
  3. /*                                                                          */
  4. /* NOTE: THIS FILE IS PUBLIC DOMAIN AND MAY BE MODIFIED AND USED AT WILL    */
  5. /*                                                                          */
  6. /* In this tutorial we show how easy it is to run in graphics mode, instead */
  7. /* of the 80x25 text mode we have been using.                               */
  8. /*                                                                          */
  9. /*                                                         Dr. Boyd Gafford */
  10. /*                                                         Kevin Huck       */
  11. /*                                                         EnQue Software   */
  12. /*                                                         09/16/92         */
  13. /****************************************************************************/
  14. #include <stdio.h>
  15. #include <fcntl.h>
  16. #include <io.h>
  17. #ifndef __TURBOC__
  18. #include <sys\types.h>
  19. #endif
  20. #include <sys\stat.h>
  21. #include <time.h>
  22. #include <ctype.h>
  23. #include <bios.h>
  24. #ifdef __ZTC__
  25.   #include <fg.h>                         /* include Zortech graphics       */
  26. #else
  27. #ifdef M_I86
  28.   #include <graph.h>                      /* include Microsoft graphics     */
  29. #endif
  30. #endif
  31. #ifdef __TURBOC__
  32.   #include <graphics.h>                   /* include Borland graphics       */
  33. #endif
  34. #include "uw.h"                           /* include the necessary headers  */
  35.  
  36.  
  37. #define MAX_CUST 50
  38.  
  39. typedef struct cust
  40. {
  41.   int status;
  42.   int cust_no;
  43.   char business[34];
  44.   char name[34];
  45.   char addr[34];
  46.   char city[34];
  47.   char state[4];
  48.   char zip[10];
  49.   char phone[16];
  50.   char fax[16];
  51.   char date[10];
  52.   char memo[34];
  53.   char unused[26];                                /* round out to 256 bytes */
  54. } CUST;
  55.  
  56. /*------------------------ global window variables -------------------------*/
  57. WINDOW  Desk_wn, Window1;
  58. CUST    Customers[MAX_CUST];
  59. char    Fname[33];
  60.  
  61. MENU    Top_menu, *Top_mnp = &Top_menu;
  62. MENU    Files_menu, Edit_menu, Print_menu;
  63. MENU    *Drop_mnps[3];
  64.  
  65. PRINT   Print;
  66.  
  67. /*-------------------------------- prototypes ------------------------------*/
  68. void init_g(void);
  69. void end_g(void);
  70. int disp_time(void);
  71. void disp_cust(CUST *cp, WINDOW *wnp);
  72. int file_load(CUST *customers);
  73. int file_save(CUST *customers);
  74. int get_fname(char *fname);
  75. void print_cust(CUST *cp, PRINT *p);
  76.  
  77. /*********/
  78. /* ~main */
  79. /*       ********************************************************************/
  80. /*  Demonstrate data entry capability...                                    */
  81. /****************************************************************************/
  82. int main()
  83. {
  84.   int i, ret_val, cust = 0, end_flag = 0, print_stat = 0;
  85.   WINDOW *wnp;
  86.   CUST *cp;
  87.   uchar back_att  = (LIGHTGRAY << 4) | BLACK,
  88.         bdr_att   = (LIGHTGRAY << 4) | BLACK,
  89.         csr_att   = (CYAN << 4) | YELLOW,
  90.         first_att = (LIGHTGRAY << 4) | RED;
  91.   
  92.   wnp = &Window1;                         /* set local window pointer       */
  93. #ifdef __ZTC__
  94.   force_video(16, 80, 25);                /* force Zortech to EGA mode      */
  95. #else
  96.   init_video(80, 25);                     /* init video for 80 x 25 screen  */
  97. #endif
  98.   init_clock(0x3333);                     /* init clock irq at 91 tics/sec  */
  99.   init_mouse();                           /* init mouse if available        */
  100.   
  101.   init_uw_graphics(640, 350, 14, 14, -1, -1);
  102.   init_g();
  103.   
  104.   wn_create(0, 0, V_cols-1, V_rows-1, NO_BDR, WN_NORMAL, &Desk_wn);
  105.   link_window(&Desk_wn);
  106.  
  107.   /*------------------------ create the menu system ------------------------*/
  108.   Drop_mnps[0] = &Files_menu;
  109.   Drop_mnps[1] = &Edit_menu;
  110.   Drop_mnps[2] = &Print_menu;
  111.  
  112.   menu_create(0, 0, V_cols - 1, 0, M_HORIZONTAL,
  113.               back_att, bdr_att, csr_att, first_att,
  114.               NO_BDR, WN_NORMAL, Top_mnp);
  115.   item_add( "   Files   ", 1, 3, &Top_menu );
  116.   item_add( "   Edit    ", 2, 3, &Top_menu );
  117.   item_add( "   Print   ", 8, 3, &Top_menu );
  118.  
  119.   menu_create(0, 1, 14, 5, M_VERTICAL,
  120.     back_att, bdr_att, csr_att, first_att,
  121.     SGL_BDR, WN_NORMAL, Drop_mnps[0]);
  122.   item_add( " Load File", 4, 1, &Files_menu );
  123.   item_add( " Save File", 5, 1, &Files_menu );
  124.   item_add( "   Quit   ", 3, 3, &Files_menu );
  125.  
  126.   menu_create(11, 1, 32, 4, M_VERTICAL,
  127.     back_att, bdr_att, csr_att, first_att,
  128.     SGL_BDR, WN_NORMAL, Drop_mnps[1]);
  129.   item_add( " Clear Current", 6, 7, &Edit_menu );
  130.   item_add( " Clear All    ", 7, 7, &Edit_menu );
  131.  
  132.   menu_create(22, 1, 43, 4, M_VERTICAL,
  133.     back_att, bdr_att, csr_att, first_att,
  134.     SGL_BDR, WN_NORMAL, Drop_mnps[2]);
  135.   item_add( " Print Current", 9, 7, &Print_menu );
  136.   item_add( " Print All    ", 10, 7, &Print_menu );
  137.  
  138.   set_idle_func(disp_time);               /* set background clock function  */
  139.  
  140.   wn_create(5, 5, 75, 20, SLD_BDR, WN_POPUP, wnp);
  141.   wn_color(YELLOW, BLUE, wnp);            /* change the window colors       */
  142.   wn_bdr_color(WHITE, BLUE, wnp);         /* change the border's colors     */
  143.   link_window(wnp);
  144.  
  145.   /*------------- initialize first customer as EnQue Software --------------*/
  146.   cp = &Customers[0];
  147.   strcpy(cp->business, "EnQue Software"); 
  148.   strcpy(cp->name, "Kevin Huck & Boyd Gafford");  
  149.   strcpy(cp->addr, "Rt. 1 Box 116C"); 
  150.   strcpy(cp->city, "Pleasant Hill");  
  151.   strcpy(cp->state, "MO");  
  152.   strcpy(cp->zip, "64080"); 
  153.   strcpy(cp->phone, "(816)987-2515"); 
  154.   strcpy(cp->fax, "(816)987-2515");      
  155.   strcpy(cp->date, "09/11/92");      
  156.   strcpy(cp->memo, "BBS 816-358-8990"); 
  157.  
  158.   /*------------------------ initialize the printer ------------------------*/
  159.   if( init_printer("LPT1", NULL, 2048L, 2048L, &Print) )
  160.     print_stat = 1;
  161.  
  162.   Top_mnp->csr_pos = M_MAX_ENTRIES;    /* set to prevent menu from hiliting */
  163.   menu_set(Top_mnp);          /* on entry, since menu is not active until   */
  164.   Top_mnp->csr_pos = 0;       /* Alt-F, Alt-E, or Alt-P is hit              */
  165.  
  166.   wn_color(LIGHTGRAY, RED, &Desk_wn);
  167.   wn_plst(CENTERED, 3, "Use cursor keypad to select customer", &Desk_wn);
  168.   wn_plst(CENTERED, 4, "or click on cursor buttons at bottom of screen", &Desk_wn);
  169.   wn_plst(CENTERED, 22, "<Up> <Dn>  <PgUp> <PgDn>  <Home> <End>", &Desk_wn);
  170.   wn_color(YELLOW, RED, &Desk_wn);
  171.   while(!end_flag)
  172.   {
  173.     cp = &Customers[cust];
  174.     mv_cs(1,1, wnp);
  175.     wn_printf(wnp, "Customer:%3d", cust+1);
  176.     disp_cust(cp, wnp);
  177.     m_show();
  178.     wait_event();
  179.     m_hide();
  180.     if( Event.is_mouse )                            /* process mouse action */
  181.     {
  182.       if( range(0,Event.m_x,11) && (Event.m_y == 0) )
  183.         Event.key = KEY_ALT_F;
  184.       else if( range(11,Event.m_x,22) && (Event.m_y == 0) )
  185.         Event.key = KEY_ALT_E;
  186.       else if( range(22,Event.m_x,33) && (Event.m_y == 0) )
  187.         Event.key = KEY_ALT_P;
  188.  
  189.       else if( range( 7,Event.m_x,47) && (Event.m_y == 9) )
  190.         Event.key = 'B';
  191.       else if( range( 7,Event.m_x,47) && (Event.m_y == 10) )
  192.         Event.key = 'N';
  193.       else if( range( 7,Event.m_x,47) && (Event.m_y == 11) )
  194.         Event.key = 'A';
  195.       else if( range( 7,Event.m_x,47) && (Event.m_y == 12) )
  196.         Event.key = 'C';
  197.       else if( range(50,Event.m_x,59) && (Event.m_y == 12) )
  198.         Event.key = 'S';
  199.       else if( range(61,Event.m_x,71) && (Event.m_y == 12) )
  200.         Event.key = 'Z';
  201.       else if( range( 7,Event.m_x,47) && (Event.m_y == 13) )
  202.         Event.key = 'P';
  203.       else if( range( 7,Event.m_x,47) && (Event.m_y == 14) )
  204.         Event.key = 'F';
  205.       else if( range( 7,Event.m_x,47) && (Event.m_y == 15) )
  206.         Event.key = 'D';
  207.       else if( range( 7,Event.m_x,47) && (Event.m_y == 16) )
  208.         Event.key = 'M';
  209.  
  210.       else if( range( 21,Event.m_x,24) && (Event.m_y == 22) )
  211.         Event.key = KEY_UP;
  212.       else if( range( 26,Event.m_x,29) && (Event.m_y == 22) )
  213.         Event.key = KEY_DN;
  214.       else if( range( 32,Event.m_x,37) && (Event.m_y == 22) )
  215.         Event.key = KEY_PGUP;
  216.       else if( range( 39,Event.m_x,44) && (Event.m_y == 22) )
  217.         Event.key = KEY_PGDN;
  218.       else if( range( 47,Event.m_x,52) && (Event.m_y == 22) )
  219.         Event.key = KEY_HOME;
  220.       else if( range( 54,Event.m_x,58) && (Event.m_y == 22) )
  221.         Event.key = KEY_END;
  222.       else
  223.         Event.key = 0;  
  224.     }
  225.     switch(Event.key)
  226.     {
  227.       /*-------------------------- process menus ---------------------------*/
  228.       case KEY_ALT_Q:                                       /* quit program */
  229.         end_flag = 1;
  230.         break;
  231.       case KEY_ALT_F: case KEY_ALT_E: case KEY_ALT_P:
  232.         m_show();
  233.         if( Event.key == KEY_ALT_F )
  234.           ret_val = menu_system_ll(&Top_menu,&Drop_mnps[0],0,'F',M_EXIT_ON_ESC);
  235.         else if( Event.key == KEY_ALT_E )
  236.           ret_val = menu_system_ll(&Top_menu,&Drop_mnps[0],0,'E',M_EXIT_ON_ESC);
  237.         else
  238.           ret_val = menu_system_ll(&Top_menu,&Drop_mnps[0],0,'P',M_EXIT_ON_ESC);
  239.         switch( ret_val )
  240.         {
  241.           case 3:                                           /* quit program */
  242.             end_flag = 1;
  243.             break;
  244.           case 4:                                           /* load file    */
  245.             file_load(Customers);
  246.             break;
  247.           case 5:                                           /* save file    */
  248.             file_save(Customers);
  249.             break;
  250.           case 6:                                           /* clear one    */
  251.             setmem(cp, sizeof(CUST), 0);
  252.             break;
  253.           case 7:                                           /* clear all    */
  254.             setmem(Customers, sizeof(Customers), 0);
  255.             break;
  256.           case 9:                                           /* print one    */
  257.             if( print_stat )
  258.               print_cust(cp, &Print);
  259.             break;
  260.           case 10:                                          /* print all    */
  261.             if( print_stat )
  262.               for( i = 0; i < MAX_CUST; i++ )
  263.                 if( strlen(Customers[i].name) )             /* not empty?   */
  264.                   print_cust(&Customers[i], &Print);
  265.             break;
  266.         }
  267.         break;
  268.       /*----------------------- process cursor keys ------------------------*/
  269.       case KEY_HOME:
  270.         cust = 0;
  271.         break; 
  272.       case KEY_END:
  273.         cust = MAX_CUST-1;
  274.         break; 
  275.       case KEY_DN: 
  276.         if( cust < MAX_CUST-1 )
  277.           cust++;
  278.         break;
  279.       case KEY_UP: 
  280.         if( cust > 0 )
  281.           cust--;
  282.         break;
  283.       case KEY_PGUP: 
  284.         if( cust >= 10 )
  285.           cust -= 10;
  286.         else
  287.           cust = 0;
  288.         break;
  289.       case KEY_PGDN: 
  290.         if( cust < MAX_CUST-11 )
  291.           cust += 10;
  292.         else
  293.           cust = MAX_CUST-1;
  294.         break;
  295.       /*-------------------- process field edit keys -----------------------*/
  296.       case 'b': case 'B':                         /* get new business name  */
  297.         mv_cs( 11, 3, wnp);
  298.         wn_gets_ll(cp->business, "________________________________",
  299.                                  "********************************",
  300.           swap_nibbles(wnp->att), G_UP_FST_CHAR2 | G_STRIP_END, 32, wnp);
  301.         break;
  302.       case 'n': case 'N':                         /* get new contact name   */
  303.         mv_cs( 11, 4, wnp);
  304.         wn_gets_ll(cp->name, "________________________________",
  305.                              "********************************",
  306.           swap_nibbles(wnp->att), G_UP_FST_CHAR2 | G_STRIP_END, 32, wnp);
  307.         break;
  308.       case 'a': case 'A':                         /* get new address        */
  309.         mv_cs( 11, 5, wnp);
  310.         wn_gets_ll(cp->addr, "________________________________",
  311.                              "********************************",
  312.           swap_nibbles(wnp->att), G_UP_FST_CHAR2 | G_STRIP_END, 32, wnp);
  313.         break;
  314.       case 'c': case 'C':                         /* get new city           */
  315.         mv_cs( 11, 6, wnp);
  316.         wn_gets_ll(cp->city, "________________________________",
  317.                              "********************************",
  318.           swap_nibbles(wnp->att), G_UP_FST_CHAR2 | G_STRIP_END, 32, wnp);
  319.         break;
  320.       case 's': case 'S':                         /* get new state          */
  321.         mv_cs( 51, 6, wnp);
  322.         wn_gets_ll(cp->state, "__", "UU",
  323.           swap_nibbles(wnp->att), G_EXIT_ON_FILL|G_STRIP_END, 2, wnp);
  324.         break;
  325.       case 'z': case 'Z':                         /* get new zip            */
  326.         mv_cs( 60, 6, wnp);
  327.         wn_gets_ll(cp->zip, "_____", "#####",
  328.           swap_nibbles(wnp->att), G_EXIT_ON_FILL|G_STRIP_END, 5, wnp);
  329.         break;
  330.       case 'p': case 'P':                         /* get new phone number   */
  331.         mv_cs( 11, 7, wnp);
  332.         wn_gets_ll(cp->phone, "(___)___-____", " ### ### ####",
  333.           swap_nibbles(wnp->att), G_EXIT_ON_FILL, 14, wnp);
  334.         break;                    
  335.       case 'f': case 'F':                         /* get new fax number     */
  336.         mv_cs( 11, 8, wnp);
  337.         wn_gets_ll(cp->fax, "(___)___-____", " ### ### ####",
  338.           swap_nibbles(wnp->att), G_EXIT_ON_FILL, 14, wnp);
  339.         break;
  340.       case 'd': case 'D':                         /* get new date           */
  341.         mv_cs( 11, 9, wnp);
  342.         wn_gets_ll(cp->date, "__/__/__", "## ## ##", swap_nibbles(wnp->att),
  343.           G_EXIT_ON_FILL, 8, wnp);
  344.         break;
  345.       case 'm': case 'M':                         /* get new memo field     */
  346.         mv_cs( 11, 10, wnp);
  347.         wn_gets_ll(cp->memo, "________________________________",
  348.                              "********************************",
  349.           swap_nibbles(wnp->att), G_STRIP_END, 32, wnp);
  350.         break;
  351.  
  352.     }
  353.   }
  354.  
  355.   unlink_window(wnp);                     /* remove the window from screen  */
  356.   wn_destroy(wnp);
  357.   set_idle_func(NULL);                    /* remove background function     */
  358.   unlink_window(&Desk_wn);                /* remove the window from screen  */
  359.   wn_destroy(&Desk_wn);
  360.   end_clock();
  361.   end_video();                            /* clean up before we exit        */
  362.   end_printer(&Print);
  363.   end_mouse();
  364.   end_g();
  365.   return(1);
  366. }
  367. /*** end of main ***/
  368.  
  369. /**************/
  370. /* ~disp_time */
  371. /*            ***************************************************************/
  372. /*  This routine is called in the background by wait_event and will display */
  373. /*  the time once per second.  Notice the use of the global variables       */
  374. /*  Uw_timers.  There is an array of four "countdown" timers that are user  */
  375. /*  accessible.  Each "timer tic" will decrement the counts by one, until   */
  376. /*  0 is reached.  By "reloading" the timer with "Tics_per_sec", we only    */
  377. /*  display the time of day once per second.  "Tics_per_sec" is set         */
  378. /*  by init_clock.                                                          */
  379. /****************************************************************************/
  380. int disp_time(void)
  381. {
  382.   time_t t;
  383.   print_in_bkgrnd();                            /* call this to print       */
  384.   if( !Uw_timers[0] )                           /* has one second passed?   */
  385.   {
  386.     Uw_timers[0] = Tics_per_sec;                /* if so, reload timer      */
  387.     t = time(NULL);                             /* get time                 */
  388.     mv_cs(55, V_rows-1, &Desk_wn);              /* move window cursor       */
  389.     wn_st_qty(ctime(&t), 24, &Desk_wn);         /* output 24 characters     */
  390.     return(1);
  391.   }
  392.   return(0);
  393. }
  394. /*** end of disp_time ***/
  395.  
  396. /**************/
  397. /* ~disp_cust */
  398. /*            ***************************************************************/
  399. /*  This routine displays a customer in the desired window...               */
  400. /****************************************************************************/
  401. void disp_cust(CUST *cp, WINDOW *wnp)
  402. {
  403.   int r = 3;
  404.  
  405.   mv_cs( 1, r++, wnp );
  406.   wn_printf( wnp, "Business: %-32s", cp->business);
  407.   mv_cs( 1, r++, wnp );
  408.   wn_printf( wnp, "Name    : %-32s", cp->name );
  409.   mv_cs( 1, r++, wnp );
  410.   wn_printf( wnp, "Address : %-32s", cp->addr );
  411.   mv_cs( 1, r++, wnp );
  412.   wn_printf( wnp, "City    : %-32s State: %2s  Zip: %5s",
  413.     cp->city, cp->state, cp->zip );
  414.   wn_cleol(wnp);                                    /* clear to end of line */
  415.   mv_cs( 1, r++, wnp );
  416.   wn_printf( wnp, "Phone   : %-16s", cp->phone );
  417.   mv_cs( 1, r++, wnp );
  418.   wn_printf( wnp, "Fax     : %-16s", cp->fax );
  419.   mv_cs( 1, r++, wnp );
  420.   wn_printf( wnp, "Date    : %-10s", cp->date );
  421.   mv_cs( 1, r++, wnp );
  422.   wn_printf( wnp, "Memo    : %-32s", cp->memo );
  423. }
  424. /*** end of disp_cust ***/
  425.  
  426. /**************/
  427. /* ~file_load */
  428. /*            ***************************************************************/
  429. /*  This routine loads a file from disk into the customer array...          */
  430. /****************************************************************************/
  431. int file_load(CUST *customers)
  432. {
  433.   FILE *fp;
  434.   
  435.   if( get_fname(Fname) )
  436.   {
  437.     if( (fp = fopen(Fname, "rb")) != NULL )
  438.     {
  439.       fread(customers, sizeof(CUST), MAX_CUST, fp);
  440.       fclose(fp);
  441.       tone(1024,10);
  442.       return(1);
  443.     }
  444.   }
  445.   return(0);
  446. }
  447. /*** end of file_load ***/
  448.  
  449. /**************/
  450. /* ~file_save */
  451. /*            ***************************************************************/
  452. /*  This routine saves a file to disk from the customer array...            */
  453. /****************************************************************************/
  454. int file_save(CUST *customers)
  455. {
  456.   FILE *fp;
  457.   
  458.   if( get_fname(Fname) )
  459.   {
  460.     if( (fp = fopen(Fname, "wb")) != NULL )
  461.     {
  462.       fwrite(customers, sizeof(CUST), MAX_CUST, fp);
  463.       fclose(fp);
  464.       tone(1024,10);
  465.       return(1);
  466.     }
  467.   }
  468.   return(0);
  469. }
  470. /*** end of file_load ***/
  471.  
  472. /**************/
  473. /* ~get_fname */
  474. /*            ***************************************************************/
  475. /*  This routine prompts the user for a filename using a popup window...    */
  476. /****************************************************************************/
  477. int get_fname(char *fname)
  478. {
  479.   int ret_val = 1;
  480.   WINDOW wn;
  481.   
  482.   wn_create(20, 8, 60, 10, SLD_BDR, WN_POPUP, &wn);
  483.   wn_set(&wn);
  484.   wn_plst(4, 0, "Enter filename:", &wn);
  485.   if( wn_gets_ll(fname, "____________", "************",
  486.       swap_nibbles(wn.att), G_STRIP_END, 12, &wn) == KEY_ESC )
  487.     ret_val = 0;
  488.   wn_destroy(&wn);
  489.   return(ret_val);
  490. }
  491. /*** end of get_fname ***/
  492.  
  493. /***************/
  494. /* ~print_cust */
  495. /*             **************************************************************/
  496. /*  This routine prints a customer in the desired window...                 */
  497. /****************************************************************************/
  498. void print_cust(CUST *cp, PRINT *p)
  499. {
  500.   print_printf( p, "Business: %-32s\r\n", cp->business);
  501.   print_printf( p, "Name    : %-32s\r\n", cp->name );
  502.   print_printf( p, "Address : %-32s\r\n", cp->addr );
  503.   print_printf( p, "City    : %-32s State: %2s  Zip: %5s\r\n",
  504.     cp->city, cp->state, cp->zip );
  505.   print_printf( p, "Phone   : %-16s\r\n", cp->phone );
  506.   print_printf( p, "Fax     : %-16s\r\n", cp->fax );
  507.   print_printf( p, "Date    : %-10s\r\n", cp->date );
  508.   print_printf( p, "Memo    : %-32s\r\n", cp->memo );
  509.   print_char(12,p);                                     /* print form feed  */
  510. }
  511. /*** end of print_cust ***/
  512.  
  513. /***********/
  514. /* ~init_g */
  515. /*         ******************************************************************/
  516. /*  simple generic init graphics routine...                                 */
  517. /****************************************************************************/
  518. void init_g(void)
  519. {
  520. #ifdef __TURBOC__
  521.   int    g_driver;                          /* the graphics device driver   */
  522.   int    g_mode;                            /* the graphics mode value      */
  523.   int    err_code;                          /* reports any graphics errors  */
  524.  
  525.   registerbgidriver(EGAVGA_driver);
  526.   g_driver = EGA;                           /* request EGA 640x350          */
  527.   g_mode = EGAHI;
  528.   initgraph( &g_driver, &g_mode, "" );
  529.   err_code = graphresult();                 /* read result of init          */
  530.   if( err_code != grOk )
  531.   {                                         /* error during init            */
  532.     printf("Graphics System Error: %s\n", grapherrormsg(err_code));
  533.     exit( 1 );
  534.   }
  535. #endif
  536. #ifdef __ZTC__
  537. #else
  538. #ifdef M_I86
  539.   _setvideomode(_ERESCOLOR);
  540. #endif
  541. #endif
  542. }
  543. /*** end of init_g ***/
  544.  
  545. /**********/
  546. /* ~end_g */
  547. /*        *******************************************************************/
  548. /*  simple generic end graphics routine...                                  */
  549. /****************************************************************************/
  550. void end_g(void)
  551. {
  552. #ifdef __TURBOC__
  553.   closegraph();
  554. #endif
  555. #ifdef __ZTC__
  556. #else
  557. #ifdef M_I86
  558.   _setvideomode(_DEFAULTMODE);
  559. #endif
  560. #endif
  561. }
  562. /*** end of end_g ***/
  563.  
  564. /*** END OF FILE ***/
  565.